﻿<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

String strLoginname= (String)request.getAttribute("loginName");
%>



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="x-ua-compatible" content="ie=7" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="<%=basePath%>articles/style/login.css.css" rel="stylesheet" type="text/css" />
<title>天津市粮油集团有限公司</title>
<script type='text/javascript' src="<%=basePath%>articles/js/login.js"></script>
<script type="text/javascript" src="<%=basePath %>ajaxFramework/jQuery/jquery.js"></script>
<script language="javascript">
var _strUrl="";
</script>
<script language="javascript">
	if(document.addEventListener){//如果是Firefox
		document.addEventListener("keypress",fireFoxHandler, true);
	}else{
		document.attachEvent("onkeypress",ieHandler);
	}
	function fireFoxHandler(evt){
		//alert("firefox");
		if(evt.keyCode==13){
//		  window.location.replace("../main/index.html") 
          submitform1();
		}
	}
	function ieHandler(evt){
		//alert("IE");
		if(evt.keyCode==13){
//			 window.location.replace("../main/index.html") 
             if (_strUrl!=""){
		   	 submitform2();
		     }else{
		   	 submitform1();}
		}
	}
	</script>
	<script type="text/javascript">
	function submitform1(){
		var loginName = document.form1.loginName.value;
		var password = document.form1.password.value;
		if(loginName == '' || password == ''){
			alert('请输入登录名及密码！');
		}else{
//		if(document.form1.baocun.checked){
				document.form1.savecookie.value='true';
//		}else{
//				document.form1.savecookie.value='false';
//		}
//			if(document.form1.tan.checked){
//				document.form1.tanchu.value='true';
//			}else{
//				document.form1.tanchu.value='no';
//			}
			document.form1.submit();
		}
	}

	function submitform2(){
		var loginName = document.form2.loginName.value;
		var password = document.form2.password.value;

		if(loginName == '' || password == ''){
			alert('请输入登录名及密码！');
		}else{
			document.form2.loginUrl.value=_strUrl;
			document.form2.submit();
		}
	}
	
	$(document).ready(function()
	{
		<%if(null!=request.getAttribute("login")){%>
	        alert('您输入的用户名或密码不正确');
		    function showResult(btn){
				$('#loginName').focus();
		    };
		<%}%>
		if(document.getElementById('loginName').value!=''){
			$('#password').focus();
		}else{
			$('#loginName').focus();
		}
		$('#hidden').hide();
		var h = ($(window).height()-$("#containerht_login").height());
		//alert(h/2);
		$("#containerht_login").css("margin-top",h/2);
		});
		
	</script>
</head>

<body>
<div id="containerht_login">
	<div class="logo_ht"><img src="<%=basePath%>articles/images/login_logo.gif" /></div>
	<div class="login_ht_blue">
    <div class="login_ht_content">
    	<div class="right">
        	<div class="text_all">
        	<form action="<%=basePath %>tjsinfo/tjsoa/system/stepin.do" name="form1" method="post">
			<div class="amend_error" style="visibility: none;">
			 <div class="content">
                        <table width="100%" border="0" cellpadding="0" cellspacing="0" height="170">
                            <tr>
                                <th width="24%">帐号</th>
                                <td width="76%"><input style="width:210px; padding:4px" name="loginName" id="loginName" type="text" class="textinput" value="<%=strLoginname %>"/></td>
                            </tr>
                            <tr>
                                <th>密码</th>
                                <td><input style="width:210px; padding:4px" id="password" name="password" type="password" class="textinput"/></td>
                            </tr>
                            <tr>
                            <div >
	            			   <input type="hidden" id="savecookie" name="savecookie" value=""/>
	            		    </div>	
                            </tr>
                            <tr>
                                <td colspan="2" align="center" style="padding-top:15px">
                                <div class="button">
                                <a href="javaScript:submitform1();"><img src="<%=basePath%>articles/images/ht_icon_dl.gif" /></a>
                                </div></td>
                            </tr>
                        </table>     
             </div>
            </div>
            </form>
            </div>
        </div>
    </div>
    <div id="footer_ht"><span>Copyright &copy; 天津市电子计算机研究所  2009-2014, All Rights Reserved</span></div>
</div>
</body>

</html>
